package com.itqf.utils;

import com.itqf.entity.SysUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;

public class ShiroUtils  {

	public   static Session getSession(){
		return   SecurityUtils.getSubject().getSession();
	}

	public   static void setAttribute(String key,String value){
		   getSession().setAttribute(key,value);
	}

	public   static Object getAttribute(String key){
		return    getSession().getAttribute(key);
	}


	public static SysUser getCurrentUser(){
		return (SysUser)SecurityUtils.getSubject().getPrincipal();
	}

	public   static long  getUId(){
		return  getCurrentUser().getUserId();
	}

}